package org.csu.hotelsys.service;

import org.csu.hotelsys.domain.ConsumAccount;
import org.csu.hotelsys.domain.Consumption;
import org.csu.hotelsys.persistence.ConsumAccountMapper;
import org.csu.hotelsys.persistence.ConsumptionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class ConsumptionService {
    @Autowired
    private ConsumptionMapper consumptionMapper;
    @Autowired
    private ConsumAccountMapper consumAccountMapper;

    public Consumption getConsumption(String listId) {
        return consumptionMapper.getConsumption(listId);
    }

    public List<Consumption> getConsumptionList() {
        return consumptionMapper.getConsumptionList();
    }

    public ConsumAccount getConsumAccount(String checkInId) {
        return consumAccountMapper.getConsumAccount(checkInId);
    }

    @Transactional
    public void updateConsumption(Consumption consumption) {
        consumptionMapper.updateConsumption(consumption);
    }

    @Transactional
    public void deleteConsumption(Consumption consumption) {
        consumptionMapper.deleteConsumption(consumption);
    }

    @Transactional
    public void updateConsumAccount(ConsumAccount consumAccount) {
        consumAccountMapper.updateConsumAccount(consumAccount);
    }
//    @Transactional
//    public void insertConsumAccount(ConsumAccount consumAccount,String checkInId,double total){consumAccountMapper.insertConsumAccount(consumAccount,checkInId,total);}
}
